]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switcherPopup: Rename destroy() to fadeAndDestroy()
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 13 Aug 2018 23:05:50 +0000 (20:05 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 9 Oct 2018 01:42:23 +0000 (22:42 -0300)
In the process of purging all usages of Shell.GenericContainer
of GNOME Shell, one specific problematic situation that might
occur is when classes have functions that would clash with any
ClutterActor or StWidget function name.

One of such example is SwitcherPopup.destroy(). Right now, this
class is a pure JavaScript class that wraps a real actor, but
soon this will change, and it'll become a St.Widget subclass.

Another problem with functions that mimic the toolkit ones is
the predictability of them; after calling destroy(), that widget
is expected to not be available anymore. In SwitcherPopup case,
it is still available for a short while. In this case, that's not
a big problem, but the show() and hide() functions in other clases
are more problematic because the actor's visibility does not
follow that.

This commit is a first step in cleaning that up, and changes the
SwitcherPopup.destroy() to fadeAndDestroy().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153

js/ui/altTab.js
js/ui/status/keyboard.js
js/ui/switcherPopup.js

index d0c3713cff93a32673fbc24c3482d34ffba24a73..88572715827e694019aadb2c4f4d938a1491f7f6 100644 (file)
@@ -262,7 +262,7 @@ var AppSwitcherPopup = new Lang.Class({
     _windowActivated(thumbnailList, n) {
         let appIcon = this._items[this._selectedIndex];
         Main.activateWindow(appIcon.cachedWindows[n]);
-        this.destroy();
+        this.fadeAndDestroy();
     },
 
     _windowEntered(thumbnailList, n) {
index a17e9c43bfa4a14b440c2eb8400ad96c3b70b2dd..b0cc9bb000ee01a74364c0e43ae1cb7d2f41bc21 100644 (file)
@@ -414,7 +414,7 @@ var InputSourceManager = new Lang.Class({
 
         let popup = new InputSourcePopup(this._mruSources, this._keybindingAction, this._keybindingActionBackward);
         if (!popup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
-            popup.destroy();
+            popup.fadeAndDestroy();
     },
 
     _keyboardOptionsChanged() {
index d645f1df9a9d8e2af57808ff49c06818a44f83d6..9c392f9be83d19309efb9b5a424741472c6304da 100644 (file)
@@ -195,7 +195,7 @@ var SwitcherPopup = new Lang.Class({
         // Note: pressing one of the below keys will destroy the popup only if
         // that key is not used by the active popup's keyboard shortcut
         if (keysym == Clutter.Escape || keysym == Clutter.Tab)
-            this.destroy();
+            this.fadeAndDestroy();
 
         return Clutter.EVENT_STOP;
     },
@@ -215,7 +215,7 @@ var SwitcherPopup = new Lang.Class({
     },
 
     _clickedOutside(actor, event) {
-        this.destroy();
+        this.fadeAndDestroy();
         return Clutter.EVENT_PROPAGATE;
     },
 
@@ -255,7 +255,7 @@ var SwitcherPopup = new Lang.Class({
             let newIndex = Math.min(n, this._items.length - 1);
             this._select(newIndex);
         } else {
-            this.actor.destroy();
+            this.fadeAndDestroy();
         }
     },
 
@@ -298,7 +298,7 @@ var SwitcherPopup = new Lang.Class({
         }
     },
 
-    destroy() {
+    fadeAndDestroy() {
         this._popModal();
         if (this.actor.visible) {
             Tweener.addTween(this.actor,
@@ -314,7 +314,7 @@ var SwitcherPopup = new Lang.Class({
     },
 
     _finish(timestamp) {
-        this.destroy();
+        this.fadeAndDestroy();
     },
 
     _onDestroy() {